//
//  InfosModel.m
//  QuickReadComic
//
//  Created by 苗钧豪 on 16/9/5.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "InfosModel.h"

@implementation InfosModel
- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"topics"]) {
        NSMutableArray<TopicsModel *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            TopicsModel *topics = [TopicsModel modelWithDic:dic];
            [array addObject:topics];
        }
        _topics = array;
    } else if ([key isEqualToString:@"banners"]) {
        NSMutableArray<BannersModel *> *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            BannersModel *banners = [BannersModel modelWithDic:dic];
            [array addObject:banners];
        }
        _banners = array;
    }
}
+ (NSDictionary *)objectClassInArray{
    return @{@"topics" : [TopicsModel class],@"banners" : [BannersModel class]};
}
@end
